﻿using System.Data;

namespace LaoLuo.Data.LayeredFramework
{
    public interface ITransactionController
    {
        /// <summary>
        /// gets the depth of current transaction
        /// </summary>
        int TransactionDepth { get; }

        /// <summary>
        /// gets a bool value that indicates whether transaction has began
        /// </summary>
        bool IsBegin { get; }

        /// <summary>
        /// gets a bool value that indicates whether transaction has commit
        /// </summary>
        bool IsCommit { get; }

        /// <summary>
        /// gets a bool value that indicates whether transaction has rollback
        /// </summary>
        bool IsRollBack { get; }

        /// <summary>
        /// gets a bool value that indicates whether current transaction is real
        /// </summary>
        bool IsReal { get; }

        void BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted);
        void CommitTransaction();
        void RollbackTransaction();
        void RealRollbackTransaction();
    }
}
